package com.heima.sjms.适配器adapter.test;

/**
 * @author 陈辉
 * @data 2023 17:34
 */
public interface Ai {
    void useAi(String channel);
}

abstract class AITool{
    public abstract void run();
}

class ChatGPT extends AITool{
    public void run(){
        System.out.println("欢迎使用ChatGPT");
    }
}

class Wxyy extends AITool{
    public void run(){
        System.out.println("欢迎使用文心一言");
    }
}

class FireAi extends AITool{
    public void run(){
        System.out.println("欢迎使用星火AI");
    }
}


class AiAdapter implements Ai{
    private AITool aiTool;

    @Override
    public void useAi(String channel) {
        if (channel.equals("ChatGPT")){
            aiTool = new ChatGPT();
        }else if (channel.equals("Wxyy")){
            aiTool = new Wxyy();
        }else if (channel.equals("FireAi")){
            aiTool = new FireAi();
        }else {
            aiTool = new ChatGPT();
        }

        aiTool.run();
    }
}